﻿Imports System.Data.SqlClient
Imports System.Configuration.ConfigurationManager
Imports System.Data.Linq
Partial Class News
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        BindCategories()
    End Sub

    Private Sub BindCategories()
        Dim cntx As New GlamUp(ConnectionStrings("GlamUpConnectionString").ConnectionString)

        Dim products = From c In cntx.Categories Group Join p In cntx.Products On c.categoryId Equals p.categoryId _
                        Into prodCount = Count() _
                        Select c.categoryName, c.categoryId, prodCount
        rptCategories.DataSource = products
        rptCategories.DataBind()
        'For Each product In products
        '    Dim prCount As Integer = product.prodCount
        '    Dim catName As String = product.categoryName

        'Next
    End Sub

End Class
